package com.health.service.Impl;

import com.health.dto.ScheduleTimeDTO;
import com.health.entity.Schedule;
import com.health.mapper.ScheduleMapper;
import com.health.service.ScheduleService;
import com.health.vo.ScheduleTimeVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class ScheduleServiceImpl implements ScheduleService {
    @Autowired
    private ScheduleMapper scheduleMapper;
    @Override
    public List<ScheduleTimeVO> timeList(ScheduleTimeDTO scheduleTimeDTO) {
        //根据日期，科室id,医生id获取 排班表
        List<Schedule> schedules = scheduleMapper.getSchedule(scheduleTimeDTO);
        List<ScheduleTimeVO> list = new ArrayList<>();

        for (Schedule schedule : schedules) {
            ScheduleTimeVO scheduleTimeVO = new ScheduleTimeVO();
            scheduleTimeVO.setShowTime(schedule.getTime());
            scheduleTimeVO.setNumberAmount(schedule.getNumberAmount());
            scheduleTimeVO.setType(schedule.getType());
            list.add(scheduleTimeVO);
        }
        return list;
    }
}
